<?php
if (!function_exists('filter_var')) {
    
    function filter_var() {
    }
}
if (!function_exists('json_decode')) {
    
    function json_decode($s, $ass = FALSE) {
        $assoc = ($ass) ? 16 : 32;
        $gloJSON = APP::N('servicesJSON', $assoc);
        return $gloJSON->decode($s);
    }
}
if (!function_exists('json_encode')) {
    
    function json_encode($s) {
        $gloJSON = APP::O('servicesJSON');
        return $gloJSON->encode($s);
    }
}
/**
 *  decode的方法可可以直接调用
 */
/**
 *  仅一次编码，防止多次编码
 *   =>%2B
 *  ~=>~
 */

function rawurlencode_($string) {
    return rawurlencode(rawurldecode($string));
}
/**
 *
 *   =>+
 *  ~=>%7E
 *  application/x-www-form-urlencoded
 */

function urlencode_($string) {
    return urlencode(urldecode($string));
}
if (!function_exists('urlencode_rfc3986')) {
    
    function urlencode_rfc3986() {
        //Prior to PHP 5.3.0, rawurlencode encoded tildes (~) as per » RFC 1738.
        return str_replace('+', ' ', str_replace('%7E', '~', call_user_func_array('urlencode_', array_shift(func_get_args()))));
    }
}
/**
 *  ct的urlemcode编码所有非\w字符
 */

function urlencode_ct($string) {
    return strtr(urlencode($string) , array(
        '+' => '%20'
    ));
}
?>